#include "Scene.h"

Scene::Scene(char const* bgfile, char const*mapfile) :
  BackgroundImageFile(NULL), MapImageFile(NULL),
  Background(NULL),
  Map(NULL)
{
  if(bgfile) {
    int len = strlen(bgfile);
    BackgroundImageFile = new char[len];
    if (BackgroundImageFile)
      strcpy(BackgroundImageFile,bgfile);
    else
      cout << "BackgroundImageFile not allocated\n" << endl;
  }

  if(mapfile) {
    int len = strlen(mapfile);
    MapImageFile = new char[len];
    if (MapImageFile)
      strcpy(MapImageFile,mapfile);
    else
      cout << "MapImageFile not allocated\n" << endl;
  }

  MapRect.x = MAP_POS_X;
  MapRect.y = MAP_POS_Y;
  MapRect.w = MAP_SIZE_X;
  MapRect.h = MAP_SIZE_Y;
}

Scene::~Scene() {
  if (BackgroundImageFile) delete[] BackgroundImageFile;
  if (Background) SDL_FreeSurface(Background);
  if (MapImageFile) delete[] MapImageFile;
  if (Map) SDL_FreeSurface(Map);
}

